<include file="public@header"/>
<style>
	.home-info{ line-height:1.8;}
    .home-info li em {
        float: left;
        width: 120px;
        font-style: normal;
        font-weight: bold;
    }

    .home-info ul {
        padding: 0;
        margin: 0;
    }

    .panel {
        margin-bottom: 0;
    }

    .grid-sizer {
        width: 10%;
    }

    .grid-item {
        margin-bottom: 5px;
        padding: 5px;
    }

    .col-xs-1, .col-sm-1, .col-md-1, .col-lg-1, .col-xs-2, .col-sm-2, .col-md-2, .col-lg-2, .col-xs-3, .col-sm-3, .col-md-3, .col-lg-3, .col-xs-4, .col-sm-4, .col-md-4, .col-lg-4, .col-xs-5, .col-sm-5, .col-md-5, .col-lg-5, .col-xs-6, .col-sm-6, .col-md-6, .col-lg-6, .col-xs-7, .col-sm-7, .col-md-7, .col-lg-7, .col-xs-8, .col-sm-8, .col-md-8, .col-lg-8, .col-xs-9, .col-sm-9, .col-md-9, .col-lg-9, .col-xs-10, .col-sm-10, .col-md-10, .col-lg-10, .col-xs-11, .col-sm-11, .col-md-11, .col-lg-11, .col-xs-12, .col-sm-12, .col-md-12, .col-lg-12 {
        padding-left: 5px;
        padding-right: 5px;
        float: none;
    }
	.emallCopyright {
		position: fixed;
		bottom: 0;
		left: 0;
		padding: 10px;
		background: #eef5ff;
		width: 100%;
		border-top: 1px solid #ddd;
	}

</style>
<hook name="admin_before_head_end"/>
</head>
<body>
<div class="wrap">
    
    <div class="home-grid">
        <!-- width of .grid-sizer used for columnWidth -->
        <div class="grid-sizer"></div>
                <div class="grid-item col-md-12" data-system="1" data-widget="{$vo.name}">
                    <div class="dashboard-box">

<php>
    $site_info = cmf_get_option('site_info');
</php>
    <div style="margin-left:-5px; margin-right:-5px;">
      <div class="col-md-6" style="float:left;">
        <div class="panel panel-default" style=" height:320px; overflow:hidden;">
            <div class="panel-heading">
                <h3 class="panel-title">{$site_info.site_name}</h3>
            </div>
            <div class="panel-body home-info">
                <ul class="list-unstyled">
                    <li>
                        <php>$site_info['gginfo'] = $site_info['gginfo'] ? $site_info['gginfo'] : "未填写";</php>
                        {$site_info.gginfo}
                    </li>
                </ul>
            </div>
        </div>
      </div>
      <div class="col-md-6" style="float:left;">
      	<div class="panel panel-default" style=" height:320px; overflow:hidden;">
            <div class="panel-heading">
                <h3 class="panel-title">用户信息</h3>
            </div>
            <div class="panel-body home-info">
                <ul class="list-unstyled">
                	<li>
                        <em>
                        <if condition="isset($admin['avatar']) && $admin['avatar']">
                            <img class="nav-user-photo" width="100" height="100"
                                 src="{:cmf_get_user_avatar_url($admin['avatar'])}" alt="{$admin.user_login}" style="border-radius:50%; border: 4px solid #b8d7ef;">
                            <else/>
                            <img class="nav-user-photo" width="100" height="100"
                                 src="/plugins/modulepara/configdata/images/avatars/avatar{$configinfo['adminface']}.png" alt="{$admin.user_login|default=''}" style="border-radius:50%; border: 4px solid #b8d7ef;">
                        </if>
                        </em>
                    </li>
                    <li>
                        <em>用户名</em>
                        <span>
                        	{$admin['user_login']}
                        </span>
                    </li>
                    <li>
                        <em>姓名</em>
                        <span>
                        	<php>$admin['user_nickname'] = $admin['user_nickname'] ? $admin['user_nickname'] : "未填写";</php>
                        	{$admin['user_nickname']}
                        </span>
                    </li>
                    <li>
                        <em>性别</em>
                        <span>
                        	<php>$sexs=array("0"=>lang('GENDER_SECRECY'),"1"=>lang('MALE'),"2"=>lang('FEMALE'));</php>
                            {$sexs[$admin['sex']]}
                        </span>
                    </li>
                    <li>
                        <em>生日</em>
                        <span>
                            {:date('Y-m-d',$admin['birthday'])}
                        </span>
                    </li>
                    <li style="margin-top:10px;">
                        <em>个人网址</em>
                        <span>
                        	<php>$admin['user_url'] = $admin['user_url'] ? $admin['user_url'] : "未填写";</php>
                            <a href="{$admin['user_url']}" target="_blank">{$admin['user_url']}</a>
                        </span>
                    </li>
                    <li>
                        <em>邮箱地址</em>
                        <span>
                        	<php>$admin['user_email'] = $admin['user_email'] ? $admin['user_email'] : "未填写";</php>
                            {$admin['user_email']}
                        </span>
                    </li>
                    <li>
                        <em>最后登录IP</em>
                        <span>
                        	<php>$admin['last_login_ip'] = $admin['last_login_ip'] ? $admin['last_login_ip'] : "未填写";</php>
                            {$admin['last_login_ip']}
                        </span>
                    </li>
                    <li>
                        <em>最后登录时间</em>
                        <span>
                        	<php>$admin['last_login_time'] = $admin['last_login_time'] ? $admin['last_login_time'] : "未填写";</php>
                            {:date('Y-m-d H:i:s',$admin['last_login_time'])}
                        </span>
                    </li>
                    <li>
                        <em>个性签名</em>
                        <span>
                        	<php>$admin['signature'] = $admin['signature'] ? $admin['signature'] : "未填写";</php>
                            {$admin['signature']}
                        </span>
                    </li>
                </ul>
            </div>
        </div>
      </div>
    </div>
    <div style="clear:both"></div>
    
    <div class="panel panel-default" style="margin-top:20px;">
            <div class="panel-heading">
                <h3 class="panel-title">订单趋势</h3>
            </div>
            <div class="panel-body home-info">
				<div id="orderqs-container" style="min-width:290px;height:290px"></div>
            </div>
        </div>
    <div style="clear:both"></div>

        <div class="panel panel-default" style="margin-top:20px;">
            <div class="panel-heading">
                <h3 class="panel-title">栏目模块</h3>
            </div>
            <div class="panel-body home-info">
                
                <div class="wb-container ">
                  <style type='text/css'>
					.wb-container *{ box-sizing: border-box; margin:0; padding:0;}
					.wb-container a{ text-decoration:none;}
					.panel-heading{ padding:10px 15px;}
					.panel-heading span{ display:inline-block; width:2px; background:#15a589; height:15px; position:relative; top:3px; left:-3px;}
					.media-body{    display: table-cell; vertical-align: top; padding-left: 10px;}
					.feed-activity-list {
						width: 100%;
						overflow: hidden;
					}
					.feed-element {
						float: left;
						width: 19%;
						height: 100px;
						margin: 0 0.5%;
						margin-bottom: 20px;
						border: 1px solid #ddd;
						border-radius:4px;
						padding: 20px;
					}
					.feed-element::after {
						display: none
					}
					.feed-element .title {
						font-size: 14px;
						height: 24px;
						line-height: 24px;
						vertical-align: bottom;
						color: #333;
						font-weight: bold;
						overflow:hidden;
						display:block;
					}
					.feed-element img.img-circle,
					.dropdown-messages-box img.img-circle {
						float: left;
						width: 60px;
						height: 60px;
						border-radius: 4px;
					}
					.media-body {
						margin-top: 3px;
					}
					.text-muted {
						display: block;
						overflow: hidden;
						text-overflow: ellipsis;
						display: -webkit-box;
						-webkit-line-clamp: 2;
						-webkit-box-orient: vertical;
					}
					</style>
                  <div class="page-content" style="background:#fff;">
                    <div class='panel panel-default' style='border:none;'>
                      <div class="feed-activity-list">
                      <php>
                        $modulewhere=array();
                        $modulewhere["arrayclass"]=$configinfo['expsupplier_adminmenuid'];
                        $modulewhere["order"]='default';
                        $modulewhere['limit'] = "all";
                        $suppliermenucate=modulepara("configmodule",$modulewhere,1);
                        </php>
                        <php>foreach($suppliermenucate as $key => $menu){</php>
                        <php>if($key < 3){</php>
                            <div style=" float:left; width:19%; margin:0 0.5%; background:#edf7ff; border:1px dashed #b7dbf7; height:100px; text-align:center; padding:5px 10px; overflow:hidden; line-height:85px; font-size:22px; color:#006fc4;">{$menu.post_title}</div>
                            <php>
                            $modulewhere=array();
                            $modulewhere["arrayclass"]=$menu['id'];
                            $modulewhere["bigclassname"]='attrid';
                            $modulewhere["order"]='default';
                            $modulewhere['limit'] = "all";
                            $modulewhere['topid'] = $configinfo['expsupplier_adminmenulistid'];
                            $suppliermenulist=modulepara("configmodule",$modulewhere,1);
                            if(!empty($menu['themodule']) && $menu['themodule'] != "other")
                            {
                                $modulewhere=array();
                                $modulewhere['classid'] = $menu['themodule'];
                                $modulewhere['limit'] = "all";
                                $suppliermenulist = configcolumn($modulewhere);
                                foreach($suppliermenulist as $key2=>$val2)
                                {
                                    $suppliermenulist[$key2]['post_title'] = $val2['name'];
                                }
                            }
                            </php>
                            <php>foreach($suppliermenulist as $key2 => $menu2){</php>
                            <php>
                            	if($menu['themodule'] && $menu['themodule'] != 'other')
                                {
                                	$menu2_url = "/portal/admin_article/index/category/".$menu2['id'].".html";
                                }else{
                                	$menu2_url = $menu2['url'];
                                }
                            </php>
                            <a class="feed-element" href="{$menu2_url}?backOk=1" data-name="{$menu2['post_title']}">
                                <span class="pull-left">
                                  <img src="/plugins/modulepara/configdata/images/app/app{$key+1}.jpg" class="img-circle" alt="image" onerror="this.src='/plugins/modulepara/configdata/images/app/app.jpg'">
                                </span>
                                <div class="media-body ">
                                  <span class="title"><span class="fl">{$menu2['post_title']}</span></span>
                                  <small class="text-muted"><notempty name="menu['description']">{$menu2['description']}<else/>{$menu2['post_title']}</notempty></small>
                                </div>
                              </a>
                            <php>}</php>
                        <php>}</php>
                        <php>}</php>
                      </div>
                    </div>
                  </div>
                </div>
                
            </div>

        </div>
        <div style="clear:both"></div>

    <php>if($configinfo['apinewsok'] == 1){</php>
    <div style="margin-left:-5px; margin-right:-5px; margin-top:20px;">
      <div class="col-md-4" style="float:left;">
        <div class="panel panel-default" style=" height:350px; overflow:hidden;">
            <div class="panel-heading">
                <h3 class="panel-title">{$configinfo['adminnews1name']}</h3>
            </div>
            <div class="panel-body home-info">
                <ul id="thinkcmf-notices" class="list-unstyled">
                    <li>
                        <img src="__TMPL__/public/assets/images/loading.gif" style="vertical-align: middle;"/>
                        <span style="display: inline-block; vertical-align: middle;">加载中...</span>
                    </li>
                </ul>
            </div>
        </div>
      </div>
      <div class="col-md-4" style="float:left;">
        <div class="panel panel-default" style=" height:350px; overflow:hidden;">
            <div class="panel-heading">
                <h3 class="panel-title">{$configinfo['adminnews2name']}</h3>
            </div>
            <div class="panel-body home-info">
                <ul id="thinkcmf-notices2" class="list-unstyled">
                    <li>
                        <img src="__TMPL__/public/assets/images/loading.gif" style="vertical-align: middle;"/>
                        <span style="display: inline-block; vertical-align: middle;">加载中...</span>
                    </li>
                </ul>
            </div>
        </div>
      </div>
      <div class="col-md-4" style="float:left;">
      	<div class="panel panel-default" style=" height:350px; overflow:hidden;">
            <div class="panel-heading">
                <h3 class="panel-title">{$configinfo['adminnews3name']}</h3>
            </div>
            <div class="panel-body home-info">
                <ul id="thinkcmf-notices3" class="list-unstyled">
                    <li>
                        <img src="__TMPL__/public/assets/images/loading.gif" style="vertical-align: middle;"/>
                        <span style="display: inline-block; vertical-align: middle;">加载中...</span>
                    </li>
                </ul>
            </div>
        </div>
      </div>
    </div>
    <php>}</php>

                   </div>
                </div>
    </div>
</div>
<script type="text/javascript" src="/plugins/styleplugins/js/styleplugins.min.js"></script>
<script src="__STATIC__/js/admin.js"></script>
<php>
    $lang_set=defined('LANG_SET')?LANG_SET:'';
    $thinkcmf_version=defined('THINKCMF_VERSION')?THINKCMF_VERSION:'';
</php>
<script>

	var articleUrl = "{:geturldecode(cmf_url('portal/Article/index',array('id'=>'(id)','cid'=>'(category_id)')))}";

	// 自定义装修排序功能
    Wind.css('dragula');
    Wind.use('masonry', 'imagesloaded', 'dragula', function () {
        var $homeGrid = $('.home-grid').masonry({
            // set itemSelector so .grid-sizer is not used in layout
            itemSelector: '.grid-item',
            // use element for option
            columnWidth: '.grid-sizer',
            percentPosition: true,
            horizontalOrder: false,
            transitionDuration: 0
        });

        $homeGrid.masonry('on', 'layoutComplete', function (event, laidOutItems) {
        });


        $homeGrid.masonry();

        // 自定义装修排序加入控制器HTML元素进行排序，暂时关闭
        var containers = [];
        $('.home-grid .grid-item').each(function () {
            //containers.push(this);
        });
        dragula(containers, {
            isContainer: function (el) {
                return false; // only elements in drake.containers will be taken into account
            },
            moves: function (el, source, handle, sibling) {
                return true; // elements are always draggable by default
            },
            accepts: function (el, target, source, sibling) {
                return true; // elements can be dropped in any of the `containers` by default
            },
            invalid: function (el, handle) {
                return false; // don't prevent any drags from initiating by default
            },
            direction: 'vertical',             // Y axis is considered when determining where an element would be dropped
            copy: false,                       // elements are moved by default, not copied
            copySortSource: false,             // elements in copy-source containers can be reordered
            revertOnSpill: false,              // spilling will put the element back where it was dragged from, if this is true
            removeOnSpill: false,              // spilling will `.remove` the element, if this is true
            mirrorContainer: document.body,    // set the element that gets mirror elements appended
            ignoreInputTextSelection: true     // allows users to select input text, see details below
        }).on('drop', function (el, target, source, sibling) {
            var $target          = $(target);
            var targetClasses    = $target.attr('class');
            var targetDataWidget = $target.data('widget');
            var targetDataSystem = $target.data('system');
            var $source          = $(source);
            var sourceClasses    = $source.attr('class');
            var sourceDataWidget = $source.data('widget');
            var sourceDataSystem = $source.data('system');
            $(source).append($(target).find('.dashboard-box').not('.gu-transit'));
            $(target).append(el);
            $target.attr('class', sourceClasses);
            $target.data('widget', sourceDataWidget);
            $target.data('system', sourceDataSystem);

            $source.attr('class', targetClasses);
            $source.data('widget', targetDataWidget);
            $source.data('system', targetDataSystem);
            $homeGrid.masonry();

            _widgetSort();
        }).on('shadow', function (el, container, source) {
            $homeGrid.masonry();
        });


    });

    function _widgetSort() {

        var widgets = [];
        $('.home-grid .grid-item').each(function () {
            var $this = $(this);

            widgets.push({
                name: $this.data('widget'),
                is_system: $this.data('system')
            });
        });

        $.ajax({
            url: "{:url('main/dashboardWidget')}",
            type: 'post',
            dataType: 'json',
            data: {widgets: widgets},
            success: function (data) {

            },
            error: function () {

            },
            complete: function () {

            }
        });
    }

    //获取官方通知
    $.getJSON("/portal/admin_ajax/index.html?ajaxid={$configinfo['adminnews1id']}&ajaxname=configmodule&limit=10",
        function (data) {
			var content = data.content;
            var tpl      = '<li style="width:100%;float:left; height:28px; line-height:28px; overflow:hidden;"><span class="title" style="float:left; width:75%;"></span><span class="date" style="float:right;"></span></li>';
            var $notices = $("#thinkcmf-notices");
            $notices.empty();
            if (content.length > 0) {
                //$('#thinkcmf-notices-grid').show();
                $.each(content, function (i, n) {
                    var $tpl = $(tpl);
					$(".title", $tpl).html("<a href='"+stylePlugins.repDynamicUrl(articleUrl, {id:n.id,category_id:n.category_id}, {left: "(", right: ")"})+"' target='_blank'>"+n.post_title+"</a>");
                    $(".date", $tpl).html(n.published_time);
                    $notices.append($tpl);
                });
            } else {
                $notices.append("<li>^_^,{:lang('NO_NOTICE')}~~</li>");
            }

        });
	$.getJSON("/portal/admin_ajax/index.html?ajaxid={$configinfo['adminnews2id']}&ajaxname=configmodule&limit=10",
        function (data) {
			var content = data.content;
            var tpl      = '<li><span class="title" style="float:left; width:75%;"></span><span class="date" style="float:right;"></span></li>';
            var $notices = $("#thinkcmf-notices2");
            $notices.empty();
            if (content.length > 0) {
                //$('#thinkcmf-notices-grid').show();
                $.each(content, function (i, n) {
                    var $tpl = $(tpl);
					$(".title", $tpl).html("<a href='"+stylePlugins.repDynamicUrl(articleUrl, {id:n.id,category_id:n.category_id}, {left: "(", right: ")"})+"' target='_blank'>"+n.post_title+"</a>");
                    $(".date", $tpl).html(n.published_time);
                    $notices.append($tpl);
                });
            } else {
                $notices.append("<li>^_^,{:lang('NO_NOTICE')}~~</li>");
            }

        });
	$.getJSON("/portal/admin_ajax/index.html?ajaxid={$configinfo['adminnews3id']}&ajaxname=configmodule&limit=10",
        function (data) {
			var content = data.content;
            var tpl      = '<li><span class="title" style="float:left; width:75%;"></span><span class="date" style="float:right;"></span></li>';
            var $notices = $("#thinkcmf-notices3");
            $notices.empty();
            if (content.length > 0) {
                //$('#thinkcmf-notices-grid').show();
                $.each(content, function (i, n) {
                    var $tpl = $(tpl);
					$(".title", $tpl).html("<a href='"+stylePlugins.repDynamicUrl(articleUrl, {id:n.id,category_id:n.category_id}, {left: "(", right: ")"})+"' target='_blank'>"+n.post_title+"</a>");
                    $(".date", $tpl).html(n.published_time);
                    $notices.append($tpl);
                });
            } else {
                $notices.append("<li>^_^,{:lang('NO_NOTICE')}~~</li>");
            }

        });
</script>
<script src="/plugins/modulepara/configdata/backend/js/highcharts.js"></script>
<script src="/plugins/modulepara/configdata/backend/js/exporting.js"></script>
<script src="/plugins/modulepara/configdata/backend/js/highcharts-zh_CN.js"></script>
<script>
var chart = Highcharts.chart('orderqs-container',{
	chart: {
		type: 'area'
	},
	title: {
		text: '本月订单趋势统计'
	},
	subtitle: {
		text: '总订单数量：100 订单总价格：￥5000元'
	},
	legend: {
        layout: 'vertical',
        align: 'left',
        verticalAlign: 'top',
        x: 150,
        y: 100,
        floating: true,
        borderWidth: 1,
        backgroundColor: (Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'
    },
	xAxis: {
		allowDecimals: false
	},
	yAxis: {
		title: {
			text: '订单总金额'
		},
		labels: {
			formatter: function () {
				return this.value / 1000 + 'k';
			}
		}
	},
	tooltip: {
		pointFormat: '{series.name} 订单金额 <b>{point.y:,.0f}</b>元'
	},
	plotOptions: {
		area: {
			pointStart: 1940,
			marker: {
				enabled: false,
				symbol: 'circle',
				radius: 2,
				states: {
					hover: {
						enabled: true
					}
				}
			}
		}
	},
	series: [{
		name: '营业额',
		data: [null, null, null, null, null, 6, 11, 32, 110, 235, 369, 640,
			   1005, 1436, 2063, 3057, 4618, 6444, 9822, 15468, 20434, 24126,
			   27387, 29459, 31056, 31982, 32040, 31233, 29224, 27342, 26662,
			   26956, 27912, 28999, 28965, 27826, 25579, 25722, 24826, 24605,
			   24304, 23464, 23708, 24099, 24357, 24237, 24401, 24344, 23586,
			   22380, 21004, 17287, 14747, 13076, 12555, 12144, 11009, 10950,
			   10871, 10824, 10577, 10527, 10475, 10421, 10358, 10295, 10104]
	}]
});
</script>
<hook name="admin_before_body_end"/>
</body>
</html>